package com.lottery.material.service.admin.article.impl;

import com.lottery.material.dao.article.ArticlePictureInfoMapper;
import com.lottery.material.pojo.article.ArticlePictureInfo;
import com.lottery.material.service.admin.article.ArticlePictureInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Description：文章图片地址信息服务接口实现类
 * Created by 朱正磊 on 2019-04-13 15:19
 */
@Service("adminArticlePictureInfoService")
public class ArticlePictureInfoServiceImpl implements ArticlePictureInfoService {

    private final ArticlePictureInfoMapper articlePictureInfoMapper;

    @Autowired
    public ArticlePictureInfoServiceImpl(ArticlePictureInfoMapper articlePictureInfoMapper) {
        this.articlePictureInfoMapper = articlePictureInfoMapper;
    }

    /**
     * description：新增一条数据
     * user 朱正磊
     * time 2019-04-20 15:14
     * @param articlePictureInfo 对象
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer add(ArticlePictureInfo articlePictureInfo) {
        return articlePictureInfoMapper.insertSelective(articlePictureInfo);
    }

    /**
     * description：根据主键物理删除
     * user 朱正磊
     * time 2019-04-20 15:13
     * @param id 主键
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer deleteById(Integer id) {
        return articlePictureInfoMapper.deleteByPrimaryKey(id);
    }

    /**
     * description：根据主键查询唯一数据
     * user 朱正磊
     * time 2019-04-20 15:15
     * @param id 主键
     * @return 返回唯一数据
     */
    @Override
    public ArticlePictureInfo findById(Integer id) {
        return articlePictureInfoMapper.selectByPrimaryKey(id);
    }

    /**
     * description：根据主键修改一条数据
     * user 朱正磊
     * time 2019-04-20 15:16
     * @param articlePictureInfo 对象
     * @return 返回持久化操作数据库状态值
     */
    @Override
    public Integer updateById(ArticlePictureInfo articlePictureInfo) {
        return articlePictureInfoMapper.updateByPrimaryKeySelective(articlePictureInfo);
    }
    
}
